<template>
    <el-dialog v-model="show" title="一键平账" width="35%" align-center @close="handleClose">
        <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="date" label="收款方名称"/>
            <el-table-column prop="name" label="摘要"  />
            <el-table-column prop="name" label="总金额"  />
            <el-table-column prop="name" label="已付款金额"  />
            <el-table-column prop="name" label="待付款金额"  />
        </el-table>
        

        <div style="color: #F76557; text-align: center; margin-top: 20px;">
            平账后，此订单后续的待付款金额将全部抵消，请慎重操作
        </div>


        <template #footer>
            <div class="dialog-footer">
                <el-button @click="handleClose">取 消</el-button>
                <el-button type="primary" @click="handleSubmit()">确 定</el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps(['visible', 'initList']);
const emits = defineEmits(['submit', 'close']);

const show = ref(false);

watch(() => props.visible, async (newValue) => {
    show.value = newValue
    if (newValue) {
    }
}, { deep: true });

const tableData = [
    {
        date: '2016-05-03',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
]


const handleSubmit = async () => {
    proxy?.$modal.msgSuccess('操作成功');
    emits('submit', true);

    handleClose();
};


const handleClose = () => {
    emits('close');
};

onMounted(() => {
})
</script>

<style lang="scss" scoped></style>